package cn.ai.shoes.core.service.impl;

import cn.ai.shoes.common.core.mybatis.LambdaQueryWrapperX;
import cn.ai.shoes.core.mapper.UserMapper;
import cn.ai.shoes.core.pojo.entity.MyUser;
import cn.ai.shoes.core.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, MyUser> implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public MyUser selectOne(String username) {
        MyUser myUser = userMapper.selectOne(
                new LambdaQueryWrapperX<MyUser>()
                        .eq(MyUser::getUsername, username)
        );
        return myUser;
    }
    @Override
    public MyUser selectOneByUid(String uid) {
        MyUser myUser = userMapper.selectOne(
                new LambdaQueryWrapperX<MyUser>()
                        .eq(MyUser::getUid, uid)
        );
        return myUser;
    }

    @Override
    public MyUser selectOneByPhone(String phone) {
        MyUser myUser = userMapper.selectOne(
                new LambdaQueryWrapperX<MyUser>()
                        .eq(MyUser::getPhone, phone)
        );
        return myUser;
    }

}




